const app = getApp();
// const controllers = app.controllers;
const controller=require("../../../controllers/ControllerVip").controller;

Page({
  data: {
    id:null,
    dataInfo:{},
  },
  onLoad: function (options) {

    let id = options.id;
    let shopId = app.globalData.shopId;
    if(options.shopId){
      shopId = options.shopId;
    }
     if(options.scene){
        let scene=decodeURIComponent(options.scene);
        console.log(scene);
        let vipId=scene.split(",")[0].split(":")[1];
        let sId=scene.split(",")[1].split(":")[1];
        if(vipId){
          id = vipId;
        }
        if(sId){
          shopId = sId;
        }
     }
    if(shopId){
      wx.setStorageSync('shopId', shopId);
      app.globalData.shopId=shopId;
    }
    this.setData({
      'id':id,
      shopId:shopId
    });



    this.getInfo();



  },
  getInfo: function () {
  
    let that = this; 

    let d = {
      accountVipId:this.data.id,
      shopId:this.data.shopId
    };
    controller.getVipDetail(d).then(res=>{
      that.setData({
        dataInfo:res.data
      })
    });


  },
  toUrl(e) {
    var d = e.currentTarget.dataset;
    let url = d.url;
    console.info(url);
    wx.navigateTo({
      url: url
    });
  },
  onBack(){
    wx.navigateBack();
  }

})